/**
 * Created by oiuyt on 2018/7/18.
 */
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'

class Showvalue extends Component {
    render() {
        const { value} = this.props
        return (
            <div style={{color:'red'}}>
                data from redux:<span>{value}</span>
            </div>
        )
    }
}
Showvalue.propTypes = {
    value: PropTypes.number.isRequired
}

function mapStateToProps2(state) {
    return {
        value: state.count
    }
}
const mapDispatchToProps2 = (dispatch) => ({})

/*
 连接状态机
 */

const Showdata = connect(
    mapStateToProps2
    ,
    mapDispatchToProps2
)(Showvalue)



export default Showdata
